{% load url_parameters %}

{% if products.paginator.num_pages > 1 %}
<div class="pagination">
    {% if products.has_previous %}
        <span class="prev"><a href="{% add_get_parameter page=products.previous_page_number %}" title="go to page {{ products.previous_page_number }}">prev</a></span>
    {% endif %}

    {% for page in products.paginator.page_range %}
        {% if page == products.number %}
            <span class="current">{{ page }}</span>
        {% else %}
            <span><a href="{% add_get_parameter page=page %}" title="go to page {{ page }}">{{ page }}</a></span>
        {% endif %}
    {% endfor %}

    {% if products.has_next %}
        <span class="next"><a href="{% add_get_parameter page=products.next_page_number %}" title="go to page {{ products.next_page_number }}">next</a></span>
    {% endif %}
</div>
{% endif %}
